package apollo

import (
	"github.com/shima-park/agollo"
	"strconv"
	"talent.com/cube/conf/g"
)

type PlayConf struct {
	Pattern int32
	Check   int32
	Rates   []OpRateConf
}

type OpRateConf struct {
	Op   int32
	Rate int32
}

type CheckProtectConf struct {
	ID       int32
	Scene    string
	PlayBuff []PlayBuffConf
}

type PlayBuffConf struct {
	Op   int32
	Buff int32
}

type BwNamespace struct {
	bwId      int
	namespace string
}

func GetBwIntValue(key string) int {
	value, _ := strconv.Atoi(g.Ap.Get(key, agollo.WithNamespace(GetBwNameSpace())))
	return value
}

func GetBwBoolValue(key string) bool {
	value, _ := strconv.ParseBool(g.Ap.Get(key, agollo.WithNamespace(GetBwNameSpace())))
	return value
}

func GetBwInt64Value(key string) int64 {
	value, _ := strconv.ParseInt(g.Ap.Get(key, agollo.WithNamespace(GetBwNameSpace())), 10, 64)
	return value
}

func GetBwFloat64Value(key string) float64 {
	value, _ := strconv.ParseFloat(g.Ap.Get(key, agollo.WithNamespace(GetBwNameSpace())), 64)
	return value
}

func GetBwStringValue(key string) string {
	return g.Ap.Get(key, agollo.WithNamespace(GetBwNameSpace()))
}

func GetBwNameSpace() string {
	return "application"
}
